<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePicturesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pictures', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('copyright');
            $table->string('url')->nullable()->comment('必应官方地址');
            $table->string('path')->comment('本地地址');
            $table->string('filename')->comment('图片的官方id不包含分辨率以及.jpg后缀');
            $table->string('resolution')->default('1920x1080')->comment('图片的分辨率');
            $table->date('datetime')->nullable();
            $table->string('hsh')->nullable()->comment('官方接口带回来的数据，如果为空，可考虑使用md5');
            $table->integer('view')->default(0)->comment('浏览次数');
            $table->integer('down')->default(0)->comment('下载次数');
            $table->integer('like')->default(0)->comment('点赞次数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pictures');
    }
}
